package com.neo.impatient.C05_Class.C05_06_AuxiliaryConstructor

class AuxiliaryTest {

  private  var name  = ""
  private  var age  = 0
  //辅助构造器
  def this(name: String) {
    this()
    this.name = name
  }
  //辅助构造器
  def this(name: String, age: Int){
    this(name)
    this.age = age
  }
}


object AuxiliaryTest{
  def main(args: Array[String]): Unit = {
    val auxiliaryTest = new AuxiliaryTest()
    println(auxiliaryTest.age)
    val auxiliaryTest1 = new AuxiliaryTest("neo")
    println(auxiliaryTest1.name)
    val auxiliaryTest2 = new AuxiliaryTest("neo",29)
    println(auxiliaryTest2.name,auxiliaryTest2.age)
  }
}
